#include <iostream>
#include <cstdlib>
#include <time.h>
#include "./user.hpp"

int User::GetDiceNum(int preset){
	if (preset!=-1) {
		return preset;
	}
	srand(time(NULL));
	if (status==Hospital||status==Jail) {
		status=Normal;
	}
	return rand()%6+1;
}

bool User::SetPos(int newPos){
	//TODO 
	//judge th pos is value
	this->pos=newPos;
	return true;
}
bool User::SetCredit(int newCredit){
	//TODO 
	this->credit=newCredit;
	return true;
}

void User::SetMoney(int newMoney){
	if (newMoney<0) {
		this->status=Bankruptcy;
		this->money=-1;
		// TODO
		// return the house and clear the tools
		return;
	}
	this->money=newMoney;
}

void User::SetStopNum(int newNum){
	ASSERT(newNum>=0);
	this->stopNum=newNum;
}
